home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12842 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  42 lines

  1. Path: newsie.dmc.com!usenet
  2. From: prozac@cape.com
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help!  Can't read input from keyboard!
  5. Date: 3 Apr 1996 02:04:20 GMT
  6. Organization: CENTnet Inc., Cambridge MA
  7. Message-ID: <4jsmb5$mlo@newsie.dmc.com>
  8. References: <4jq0ts$5mh@taniemarie.solon.com>
  9. NNTP-Posting-Host: tsa_33.cape.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. In article <4jq0ts$5mh@taniemarie.solon.com>, seebs@taniemarie.solon.com 
  15. asks something like a trick question or are the more than one Peter Seebachs
  16. >        #include <stdio.h>
  17. >        int main(void) {
  18. >                int i = 0;
  19. >                (void) sscanf, "3", "%d", i;
  20. >                (void) printf, "%d", i;
  21. >                return 0;
  22. >        }
  23. >
  24. >Can anyone help?  I have cast sscanf() to void to prevent it from erroring.
  25.  
  26. The void is HIDING the error!  
  27.  
  28. This is a "meaningless use of expression". Without the parens, 
  29. the function identifier is a pointer not a call.  
  30.  
  31. They are like nul statements:
  32.  
  33.     ;
  34.     0;
  35.     1,2;
  36. etc.
  37.     
  38. Use parens for normal function calls.
  39.  
  40.  
  41.  
  42.